import axios from "axios";
const axiosInstance = axios.create({
    baseURL: 'http://127.0.0.1:3000'
})
axiosInstance.interceptors.response.use(
    (response) => {
        if (response.data && response.data.success) {
            return response.data //返回响应体，可以在代码直接获取响应体
        } else {
            throw new Error(response.data.message || '服务端错误')
        }
    },
    (error) => {
        console.error('错误',error)
        throw error;
    }
)
export default axiosInstance